<template>
  <div id="shouye">
    <wang-header></wang-header>
    <ul class="headerBottom">
      <li v-for="(item, index) in aMenu" @click="doClick(index)">
        <router-link :to="item.path">{{item.title}}</router-link>
      </li>
      <span class="activeSpan" ref="line"></span>
    </ul>
    <router-view/>
    <wang-footer></wang-footer>
  </div>
</template>
<script>
import WangHeader from '../../components/WangHeader/WangHeader'
import WangFooter from '../../components/WangFooter/WangFooter'
export default {
  name: 'shouye',
  components: {
    WangHeader,
    WangFooter
  },
  data() {
    return {
      aMenu: [
        {
          title: '推荐',
          path: '/shouye/tuijian'
        },
        {
          title: '贼惦记',
          path: '/shouye/zeidianji'
        },
        {
          title: '美食',
          path: '/shouye/food'
        },
        {
          title: '母婴',
          path: '/shouye/baby'
        }
      ]
    }
  },
  methods: {
    doClick(i) {
      this.$refs.line.style.left = (4 * i + 1.33) + 'rem'
    }
  }
}
</script>
<style scoped>
  .headerBottom{
    display: flex;
    height: 1.33rem;
    line-height: 1.33rem;
    position: relative;
    background: #fff;
  }
  .headerBottom li{
    flex: 1;
    text-align: center;
    font-size: 0.67rem;
    color: #333;
  }
  .headerBottom .active{
    color: #e83d41;
  }
  .activeSpan{
    width: 1.33rem;
    height: 0.05rem;
    position: absolute;
    bottom: 0;
    background: #e53e42;
    left: 1.33rem;
  }
  .router-link-active{
    color: #e83d41;
  }
</style>
